package com.kuang.lesson03.udp

import java.net.DatagramPacket
import java.net.DatagramSocket

fun main() {
    //等待客户端的连接
    val buffer = ByteArray(DEFAULT_BUFFER_SIZE)
    val packet = DatagramPacket(buffer, buffer.size)
    DatagramSocket(9999).use {
        it.receive(packet)  //阻塞接收
    }
    println(String(packet.data,0,packet.length))
}